#include <stdio.h>
#include <stdlib.h>

int show_data(int d[],int size)
{
	int i;
	for(i=0;i<size;i++)
	{
		printf("%4d",d[i]);
	}
	printf("\n");
}

int bubble_sort(int d[],int size)
{
	int temp;
	int i,j;

	for(i=0;i<size;i++)
	{
		for(j=i+1;j<size;j++)
		{
			if(d[i]>d[j])
			{
				temp = d[i];
				d[i] = d[j];
				d[j] = temp;
			}

		}
	}
}

int main()
{
	int data[]={3,2,5,8,11,9,13,1,22,99,54,12,33,8};
	int num = sizeof(data)/sizeof(data[0]);

	printf("data:\n");
	show_data(data,num);
	
	bubble_sort(data,num);

	printf("After bubble sort:\n");
	printf("data:\n");
	show_data(data,num);

	return 0;
}
